<%@page import="org.prs.model.member.Member"%>
<%@page import="org.prs.persistence.member.MemberDatabasePersistenceManager"%>
<%@page import="org.prs.model.UserLevel"%>
<%@page import="org.prs.persistence.UserLevelDatabasePersitenceManager"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="com.prs.util.NameUtil"%>
<%@page import="org.prs.persistence.UserDatabasePersitenceManager"%>
<%@page import="java.util.List"%>
<%@page import="org.prs.model.User"%>
<%@page import="org.apache.commons.validator.GenericValidator"%>
<%@page contentType="text/html"  language="java" %>
<%

    User loggedInUser = (User) session.getAttribute("loggedinuser");

    if (loggedInUser == null) {
        session.setAttribute("loginmsg", "<div id='loginmsg'>Please log in to use services</div>");
        response.sendRedirect("index.jsp");
    }
    MemberDatabasePersistenceManager persistMember = new MemberDatabasePersistenceManager();
    List<Member> members = persistMember.getMembers();
    System.out.println(members.size());

    request.setAttribute("members", members);

%>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <link href="style.css" rel="stylesheet" type="text/css" media="screen" />
        <script type="text/javascript" src="js/menu.js">
        </script>

        <title>Patnership Registration System | List Users</title>
        <link rel="SHORTCUT ICON" href="images/favicon.ico" />
        <script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.8.10.custom.min.js"></script>
        <link rel="stylesheet" href="css/jquery/jquery-ui-1.8.10.custom.css" type="text/css" />

    </head>
    <body>
        <div id="wrapper">
            <div id="header">
                <div id="logo">
                    <h1><a href="#">Patnership Record System </a></h1>
                </div>
                <div id="menu">
                    <jsp:include page="includes/header.jsp"></jsp:include>
                </div>
            </div>
            <!-- end #header -->
            <div id="page">
                <div id="page-bgtop">
                    <div id="page-bgbtm">
                        <div id="content">
                            <table class='userslist'>

                                <tr><th>Name</th><th>View Member</th></tr>
                                <c:forEach items="${members}" var="member">
                                    <tr>
                                        <td>
                                            ${member.firstName} ${member.middleName} ${member.lastName}
                                        </td>
                                        <td>
                                            <a href="viewMember.jsp?id=${member.id}">View ${member.firstName}</a>
                                        </td>
                                    </tr> 
                                </c:forEach>

                            </table>



                        </div>
                        <!-- end #content -->
                        <div id="sidebar">
                            <jsp:include page="includes/userProfile.jsp"></jsp:include>
                        </div>
                        <!-- end #sidebar -->
                        <div style="clear: both;">&nbsp;</div>
                    </div>
                </div>
            </div>
            <!-- end #page -->
        </div>
        <div id="footer">
            <p>Copyright (c) 2011 prs.org. All rights reserved. Design by <a href="http://rwebs.javassl.com/">Java Servlet Systems Limited</a>.</p>
        </div>
        <!-- end #footer -->
    </body>
</html>
